package cn.fql.ymcc.feignclient;

import cn.fql.ymcc.domain.Login;
import cn.fql.ymcc.query.LoginQuery;
import cn.fql.ymcc.result.JSONResult;
import cn.fql.ymcc.result.PageList;
import com.baomidou.mybatisplus.plugins.Page;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@FeignClient(value = "service-uaa",fallbackFactory = LoginFallback.class)
public interface ILoginFeignClient {
    /**
     * 保存和修改公用的
     */
    @RequestMapping(value="/login/save",method= RequestMethod.POST)
    public JSONResult saveOrUpdate(@RequestBody Login login);

    /**
     * 删除对象
     */
    @RequestMapping(value="/login/{id}",method=RequestMethod.DELETE)
    public JSONResult delete(@PathVariable("id") Long id);

    /**
     * 获取对象
     */
    @RequestMapping(value = "/login/{id}",method = RequestMethod.GET)
    public JSONResult get(@PathVariable("id")Long id);


    /**
     * 查询所有对象
     */
    @RequestMapping(value = "/login/list",method = RequestMethod.GET)
    public JSONResult list();


    /**
     * 带条件分页查询数据
     */
    @RequestMapping(value = "/login/pagelist",method = RequestMethod.POST)
    public JSONResult page(@RequestBody LoginQuery query);

    /**
     * 通过username获取对象
     */
    @RequestMapping(value = "/login/getlogin/{username}",method = RequestMethod.GET)
    @ApiOperation(value = "通过username获取对象")
    public Login getOneByUsername(@PathVariable("username")String username);
}
